// 所有关于课程学习页面的接口
import request from "../utils/request";
// 已登录获取课程
export function loginCourseInfo(courseId) {
    return request("/Handler/OnCourseHandler.ashx?action=learnshow", "post", {
        courseId: courseId
    })
}
// 购买接口
export function buyCourseApi(courseId, userName) {
    return request("/Handler/OnCourseHandler.ashx?action=buy", "post", {
        courseId: courseId,
        userName: userName
    })
}

// 获取课程下的所有目录接口
export function getCourseDir(CDid, c_id) {
    return request("/Handler/getCourseDirAndVideo?action=getdirvideo", "post", {
        CDid: CDid, //课程的ID
        c_id: c_id //课程的_id
    })
}

//评价接口
// 
export function pjApi(data) {
    return request("/Handler/OnCourseHandler.ashx?action=addcoursecomments", "post", data)
}

// 获取目录下的视频接口
// 需要目录的_id 需要的是课程的_id 

export function getDirVideo(data) {
    return request("/VideoHandler?action=showdir", "get", data)
}

//收藏课程
export function CollectionCourse(courseId, userName) {
    return request("/Handler/OnCourseHandler.ashx?action=collection", "post", {
        userName: userName,
        courseId: courseId
    })
}
// 我的课程接口
export function myCourseApi(userName) {
    return request("/Handler/OnCourseHandler.ashx?action=mycourse", "get", { userName: userName })
}

// 我的收藏接口
export function mycollectionApi(userName) {
    return request("/Handler/OnCourseHandler.ashx?action=mycollection", "get", { userName: userName })
}
// 删除我的收藏
export function delCollection(courseId) {
    return request("/Handler/OnCourseHandler.ashx?action=deletecollection", "post", {
        courseId: courseId
    })
}